package com.sk.cardeal.act.manage;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.sk.cardeal.R;
import com.sk.cardeal.act.home.fragment.AlreadyPayFragment;
import com.sk.cardeal.act.home.fragment.FixingFragment;
import com.sk.cardeal.act.home.fragment.WaitPayFragment;
import com.sk.cardeal.act.home.fragment.WaitSendFragment;
import com.sk.cardeal.act.manage.fragment.InFragment;
import com.sk.cardeal.act.manage.fragment.InvehtoryFragment;
import com.sk.cardeal.act.manage.fragment.OutFragment;
import com.sk.cardeal.adapter.MyPagerAdapter;
import com.sk.cardeal.base.BaseFragment;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by sk on 2017/12/14.
 */

public class ManageFragment extends BaseFragment {


    @BindView(R.id.my_table)
    TabLayout myTable;
    @BindView(R.id.my_pager)
    ViewPager myPager;
    Unbinder unbinder;

    private OutFragment outFragment;
    private InFragment inFragment;
    private InvehtoryFragment invehtoryFragment;
    private List<Fragment> fragmentList = new ArrayList<>();

    @Override
    protected int getContentView() {
        return R.layout.fragment_manage;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        initFragments();
    }



    private void initFragments() {

        outFragment = new OutFragment();
        inFragment = new InFragment();
        invehtoryFragment = new InvehtoryFragment();

        fragmentList.add(outFragment);
        fragmentList.add(inFragment);
        fragmentList.add(invehtoryFragment);

        myPager.setOffscreenPageLimit(3);

        MyPagerAdapter adapter = new MyPagerAdapter(getChildFragmentManager(), getResources().getStringArray(R.array.manage_array), fragmentList);
        myPager.setAdapter(adapter);
        myTable.setupWithViewPager(myPager);

    }

}
